using System;
using System.IO;

namespace DZTC.Base32Utility.Core
{
    public class FileHelpers
    {
        public static bool CompareFileNames(string file1, string file2)
        {
            if (ReferenceEquals(file1, file2)) return true;
            if (file1 == null || file2 == null) return false;

            file1 = Path.GetFullPath(file1);
            file2 = Path.GetFullPath(file2);

            return String.Equals(file1, file2, StringComparison.OrdinalIgnoreCase);
        }

        public static bool CheckFileNameCorrectness(string fileName)
        {
            try
            {
                var fi = new FileInfo(fileName);
                return true;
            }
            catch (ArgumentException)
            {
            }
            catch (PathTooLongException)
            {
            }
            catch (NotSupportedException)
            {
            }

            return false;
        }
    }
}